package com.qingzhuge.scheduler.entity;

import com.qingzhuge.entity.BasePkLongEntity;
import com.qingzhuge.scheduler.enums.JobType;
import com.qingzhuge.scheduler.enums.TimeType;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * @author : zero.xiao
 * @description :计划任务信息
 * @date :2019-05-17 14:21
 * @modified :
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "sys_task_scheduled")
public class SysTaskScheduled extends BasePkLongEntity {
    /**任务调度数据的key*/
    public static final String JOB_DATA_MAP_SCHEDULED = "scheduled_jobDataMap";
    /**开始执行时间，*/
    private Date startTime;
    /**结束执行时间，null永远执行*/
    private Date endTime;
    /**执行次数,会覆盖结束时间*/
    private Integer count;
    /**间隔执行时间类型，为空时，仅执行一次，执行次数无效，基于执行次数，count < 1 or null 无效*/
    private TimeType timeType;
    /**间隔执行时间,默认5*/
    private Integer time;
    /**执行时间*/
    private Date fireTime;
    /**上一次执行时间*/
    private Date previousFireTime;
    /**下次执行时间*/
    private Date nextFireTime;
    /**任务名称*/
    private String taskName;
    /**任务分组*/
    private String taskGroup;
    /**任务状态 0禁用 1启用*/
    private Integer status;
    /**任务运行时间表达式:在线生成地址->http://cron.qqe2.com/*/
    private String taskCron;
    /**任务描述*/
    private String taskDesc;
    /**任务类型*/
    private JobType jobType;
    /**任务对象*/
    private String targetObject;
    /**作业id*/
    private Long taskJobId;
    /**任务方法*/
    private String targetMethod;
    /**通知邮箱主题标题*/
    private String contactName;
    /**通知邮箱地址*/
    private String contactEmail;

    public SysTaskScheduled() {
    }

    public SysTaskScheduled(Long id, String taskName, String taskGroup) {
        super(id);
        this.taskName = taskName;
        this.taskGroup = taskGroup;
    }
}
